package com.hqd.ch03.v49.core.type.filter;

import com.hqd.ch03.v49.core.type.ClassMetadata;
import com.hqd.ch03.v49.core.type.classreading.MetadataReader;
import com.hqd.ch03.v49.core.type.classreading.MetadataReaderFactory;

import java.io.IOException;

public abstract class AbstractClassTestingTypeFilter implements TypeFilter {

    @Override
    public final boolean match(MetadataReader metadataReader, MetadataReaderFactory metadataReaderFactory)
            throws IOException {

        return match(metadataReader.getClassMetadata());
    }

    /**
     * Determine a match based on the given ClassMetadata object.
     *
     * @param metadata the ClassMetadata object
     * @return whether this filter matches on the specified type
     */
    protected abstract boolean match(ClassMetadata metadata);

}